import Vue from 'vue';
import App from './App.vue';
import router from './router';
import axios from 'axios';
import './plugins/element.js';
import TreeTable from 'vue-table-with-tree-grid'

Vue.config.productionTip = false;

// 设置请求根路径
axios.defaults.baseURL = 'http://127.0.0.1:8888/api/private/v1/'

// 设置请求拦截
axios.interceptors.request.use(config => {
  // 给请求头挂载一个 Authorization 属性
  config.headers.Authorization = window.sessionStorage.getItem('token')

  return config
})

Vue.prototype.$http = axios

// 注册树型表组件
Vue.component('tree-table', TreeTable)

new Vue({
  router,
  render: (h) => h(App),
}).$mount('#app');
